<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Module: Prismic
  
    &mdash; Documentation by YARD 0.8.7.4
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '';
  framesUrl = "frames.html#!Prismic.html";
</script>


  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (P)</a> &raquo;
    
    
    <span class="title">Prismic</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Module: Prismic
  
  
  
</h1>

<dl class="box">
  
  
    
  
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">lib/prismic.rb<span class="defines">,<br />
  lib/prismic/api.rb,<br /> lib/prismic/form.rb,<br /> lib/prismic/version.rb,<br /> lib/prismic/cache/lru.rb,<br /> lib/prismic/predicates.rb,<br /> lib/prismic/experiments.rb,<br /> lib/prismic/json_parsers.rb,<br /> lib/prismic/with_fragments.rb,<br /> lib/prismic/fragments/date.rb,<br /> lib/prismic/fragments/link.rb,<br /> lib/prismic/fragments/text.rb,<br /> lib/prismic/fragments/image.rb,<br /> lib/prismic/fragments/embed.rb,<br /> lib/prismic/fragments/color.rb,<br /> lib/prismic/fragments/group.rb,<br /> lib/prismic/fragments/select.rb,<br /> lib/prismic/fragments/slices.rb,<br /> lib/prismic/fragments/number.rb,<br /> lib/prismic/fragments/multiple.rb,<br /> lib/prismic/fragments/fragment.rb,<br /> lib/prismic/fragments/geopoint.rb,<br /> lib/prismic/fragments/timestamp.rb,<br /> lib/prismic/fragments/separator.rb,<br /> lib/prismic/fragments/structured_text.rb</span>
</dd>
  
</dl>
<div class="clear"></div>

<h2>Defined Under Namespace</h2>
<p class="children">
  
    
      <strong class="modules">Modules:</strong> <span class='object_link'><a href="Prismic/DefaultHTTPClient.html" title="Prismic::DefaultHTTPClient (module)">DefaultHTTPClient</a></span>, <span class='object_link'><a href="Prismic/Fragments.html" title="Prismic::Fragments (module)">Fragments</a></span>, <span class='object_link'><a href="Prismic/JsonParser.html" title="Prismic::JsonParser (module)">JsonParser</a></span>, <span class='object_link'><a href="Prismic/Predicates.html" title="Prismic::Predicates (module)">Predicates</a></span>, <span class='object_link'><a href="Prismic/WithFragments.html" title="Prismic::WithFragments (module)">WithFragments</a></span>
    
  
    
      <strong class="classes">Classes:</strong> <span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span>, <span class='object_link'><a href="Prismic/BasicNullCache.html" title="Prismic::BasicNullCache (class)">BasicNullCache</a></span>, <span class='object_link'><a href="Prismic/Document.html" title="Prismic::Document (class)">Document</a></span>, <span class='object_link'><a href="Prismic/Error.html" title="Prismic::Error (class)">Error</a></span>, <span class='object_link'><a href="Prismic/Experiment.html" title="Prismic::Experiment (class)">Experiment</a></span>, <span class='object_link'><a href="Prismic/Experiments.html" title="Prismic::Experiments (class)">Experiments</a></span>, <span class='object_link'><a href="Prismic/Field.html" title="Prismic::Field (class)">Field</a></span>, <span class='object_link'><a href="Prismic/Form.html" title="Prismic::Form (class)">Form</a></span>, <span class='object_link'><a href="Prismic/HtmlSerializer.html" title="Prismic::HtmlSerializer (class)">HtmlSerializer</a></span>, <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span>, <span class='object_link'><a href="Prismic/LruCache.html" title="Prismic::LruCache (class)">LruCache</a></span>, <span class='object_link'><a href="Prismic/Ref.html" title="Prismic::Ref (class)">Ref</a></span>, <span class='object_link'><a href="Prismic/Response.html" title="Prismic::Response (class)">Response</a></span>, <span class='object_link'><a href="Prismic/SearchForm.html" title="Prismic::SearchForm (class)">SearchForm</a></span>, <span class='object_link'><a href="Prismic/Variation.html" title="Prismic::Variation (class)">Variation</a></span>
    
  
</p>

  <h2>Constant Summary</h2>
  
    <dl class="constants">
      
        <dt id="EXPERIMENTS_COOKIE-constant" class="">EXPERIMENTS_COOKIE =
          
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>io.prismic.experiment</span><span class='tstring_end'>&#39;</span></span></pre></dd>
      
        <dt id="PREVIEW_COOKIE-constant" class="">PREVIEW_COOKIE =
          
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>io.prismic.preview</span><span class='tstring_end'>&#39;</span></span></pre></dd>
      
        <dt id="VERSION-constant" class="">VERSION =
          
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>1.4.1</span><span class='tstring_end'>&#39;</span></span></pre></dd>
      
        <dt id="DefaultCache-constant" class="">DefaultCache =
          <div class="docstring">
  <div class="discussion">
    <p>This default instance is used by the API to avoid creating a new instance
per request (which would make the cache useless).</p>


  </div>
</div>
<div class="tags">
  

</div>
        </dt>
        <dd><pre class="code"><span class='const'>LruCache</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span></pre></dd>
      
    </dl>
  







  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#api-class_method" title="api (class method)">+ (API) <strong>api</strong>(url, opts = nil) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Return an API instance The access token and HTTP client can be provided.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#html_serializer-class_method" title="html_serializer (class method)">+ (Object) <strong>html_serializer</strong>(&amp;blk) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#link_resolver-class_method" title="link_resolver (class method)">+ (LinkResolver) <strong>link_resolver</strong>(ref) {|doc_link| ... }</a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Build a <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> instance The <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> will help to build URL specific to an application, based on a generic prismic.io&#39;s <span class='object_link'><a href="Prismic/Fragments/DocumentLink.html" title="Prismic::Fragments::DocumentLink (class)">Document link</a></span>.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#oauth_check_token-class_method" title="oauth_check_token (class method)">+ (String) <strong>oauth_check_token</strong>(url, oauth_opts, api_opts = nil) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Check a token and return an access_token.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#oauth_initiate_url-class_method" title="oauth_initiate_url (class method)">+ (String) <strong>oauth_initiate_url</strong>(url, oauth_opts, api_opts = nil) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Build the URL where the user can be redirected to authenticated himself using OAuth2.</p>
</div></span>
  
</li>

      
    </ul>
  



  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="api-class_method">
  
    
      <span class="overload">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url) </span>
    
      <span class="overload">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url, opts) </span>
    
      <span class="overload">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url, access_token) </span>
    
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Return an API instance
The access token and HTTP client can be provided.</p>

<p>The HTTP Client must responds to same method than <span class='object_link'><a href="Prismic/DefaultHTTPClient.html" title="Prismic::DefaultHTTPClient (module)">DefaultHTTPClient</a></span>.</p>


  </div>
</div>
<div class="tags">
  
  <p class="tag_title">Overloads:</p>
  <ul class="overload">
    
      
      <li class="overload_item">
        <span class="signature">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url) </span>
        <div class="docstring">
  <div class="discussion">
    <p>Simpler syntax (no configuration)</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The URL of the prismic.io repository</p>
</div>
      
    </li>
  
</ul>


</div>
      </li>
    
      
      <li class="overload_item">
        <span class="signature">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url, opts) </span>
        <div class="docstring">
  <div class="discussion">
    <p>Standard use</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The URL of the prismic.io repository</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>opts</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The options</p>
</div>
      
    </li>
  
</ul>

  
    
    
    
    
    <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:access_token</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
              &mdash; default:
              <tt>nil</tt>
            
          </span>
          
            &mdash; <div class='inline'><p>The access_token</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:http_client</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
              &mdash; default:
              <tt>DefaultHTTPClient</tt>
            
          </span>
          
            &mdash; <div class='inline'><p>The HTTP client to use</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:cache</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
              &mdash; default:
              <tt>nil</tt>
            
          </span>
          
            &mdash; <div class='inline'><p>The caching object (for instance Prismic::Cache) to use, or false for no caching</p>
</div>
          
        </li>
      
    </ul>
  


</div>
      </li>
    
      
      <li class="overload_item">
        <span class="signature">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url, access_token) </span>
        <div class="docstring">
  <div class="discussion">
    <p>Provide the access_token (only)</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The URL of the prismic.io repository</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>access_token</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The access token</p>
</div>
      
    </li>
  
</ul>


</div>
      </li>
    
  </ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The API instance related to this repository</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>PrismicWSConnectionError</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


64
65
66
67
68
69
70
71</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic.rb', line 64</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_api'>api</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='lparen'>(</span><span class='kw'>not</span> <span class='id identifier rubyid_url'>url</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A</span><span class='embexpr_beg'>#{</span><span class='const'>URI</span><span class='op'>::</span><span class='id identifier rubyid_regexp'>regexp</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>http</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>https</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>\z</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Valid web URI expected</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_opts'>opts</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
  <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>access_token:</span> <span class='id identifier rubyid_opts'>opts</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
  <span class='const'>API</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="html_serializer-class_method">
  
    + (<tt>Object</tt>) <strong>html_serializer</strong>(&amp;blk) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


621
622
623</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic.rb', line 621</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_html_serializer'>html_serializer</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
  <span class='const'>HtmlSerializer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="link_resolver-class_method">
  
    + (<tt><span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span></tt>) <strong>link_resolver</strong>(ref) {|doc_link| ... }
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Build a <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> instance
The <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> will help to build URL specific to an application, based
on a generic prismic.io&#39;s <span class='object_link'><a href="Prismic/Fragments/DocumentLink.html" title="Prismic::Fragments::DocumentLink (class)">Document link</a></span>.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>ref</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Prismic/Ref.html" title="Prismic::Ref (class)">Ref</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The ref to use</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
  
    <li>
      
        <span class='name'>doc_link</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Prismic/Fragments/DocumentLink.html" title="Prismic::Fragments::DocumentLink (class)">Fragments::DocumentLink</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>A DocumentLink instance</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The application specific URL of the given document</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> instance</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


617
618
619</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic.rb', line 617</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_link_resolver'>link_resolver</span><span class='lparen'>(</span><span class='id identifier rubyid_ref'>ref</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
  <span class='const'>LinkResolver</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_ref'>ref</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="oauth_check_token-class_method">
  
    + (<tt>String</tt>) <strong>oauth_check_token</strong>(url, oauth_opts, api_opts = nil) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Check a token and return an access_token</p>

<p>This method allows to check the token received when the user has been
redirected from the OAuth2 server. It returns an access_token that can
be used to authenticate the user on the API.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The URL of the prismic.io repository</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>oauth_opts</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The OAuth2 options</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>api_opts</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The API options (the same than accepted by the
<span class='object_link'><a href="#api-class_method" title="Prismic.api (method)">api</a></span> method)</p>
</div>
      
    </li>
  
</ul>

  
    
    
    
    
    <p class="tag_title">Options Hash (<tt>oauth_opts</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:client_id</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'><p>The Application&#39;s client ID</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:redirect_uri</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'><p>The Application&#39;s secret</p>
</div>
          
        </li>
      
    </ul>
  
    
    

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the access_token</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>PrismicWSConnectionError</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


115
116
117
118
119</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic.rb', line 115</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_oauth_check_token'>oauth_check_token</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_api_opts'>api_opts</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
  <span class='id identifier rubyid_api_opts'>api_opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>access_token:</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
  <span class='const'>API</span><span class='period'>.</span><span class='id identifier rubyid_oauth_check_token'>oauth_check_token</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="oauth_initiate_url-class_method">
  
    + (<tt>String</tt>) <strong>oauth_initiate_url</strong>(url, oauth_opts, api_opts = nil) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Build the URL where the user can be redirected to authenticated himself
using OAuth2.
@note: The endpoint depends on the repository, so an API call is made to
fetch it.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>url</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The URL of the prismic.io repository</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>oauth_opts</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The OAuth2 options</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>api_opts</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The API options (the same than accepted by the <span class='object_link'><a href="#api-class_method" title="Prismic.api (method)">api</a></span>
method)</p>
</div>
      
    </li>
  
</ul>

  
    
    
    
    
    <p class="tag_title">Options Hash (<tt>oauth_opts</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:client_id</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'><p>The Application&#39;s client ID</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:redirect_uri</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'><p>The Application&#39;s secret</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:scope</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'><p>The desired scope</p>
</div>
          
        </li>
      
    </ul>
  
    
    

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The built URL</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>PrismicWSConnectionError</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


92
93
94
95
96</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/prismic.rb', line 92</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_oauth_initiate_url'>oauth_initiate_url</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_api_opts'>api_opts</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
  <span class='id identifier rubyid_api_opts'>api_opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>access_token:</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
  <span class='const'>API</span><span class='period'>.</span><span class='id identifier rubyid_oauth_initiate_url'>oauth_initiate_url</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Tue Sep 27 10:47:05 2016 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.4 (ruby-2.0.0).
</div>

  </body>
</html>